<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta name="author" content="lushu">
		<title>充值点日结管理</title>
		<script type="text/javascript" src="../script/common.js" language="JavaScript"></script>
		<script type="text/javascript" language="javascript" src="../script/common_stat.js"></script>
		<script type="text/javascript" language="JavaScript">
			var Page;
	
			function init(){
				Eui.showNavigation();
				Page = {};//页面元素Page
				Page.form = $("searchForm");//form对象
				Page.crosstab = new Crosstab();
				Page.columns = [];//列表项
				Page.PresetOrg = {org:true};//是否初始化机构控件到当前管理员所在机构
				Page.OrgLevel = {org:Constants.ORG_LEVEL_STATION};//默认机构选择的截止级别
				Page.selection = {};
				initPageElements();//由页面定义的具体初始化内容
				ListPage.initDateSelects();
				Page.form.startDate.value = TX.Misc.getDateBefore(Page.DEFAULT_CUTOFF+Page.DEFAULT_INTERNAL);
				Page.form.endDate.value = TX.Misc.getDateBefore(Page.DEFAULT_CUTOFF);
				Clear.List.initOrganizations();//初始化受理机构和发卡机构对象
				ListPage.initFormElements();//页面select元素的初始化
				Page.columns[ListPage.COLUMNS_LENGTH_MAX] = 
					{	title:"操作",
						width:"5%",
						align:"left",
						render:operation
					};
				Page.qt = new QueryTable(Page.sql,Page.form,"datalist",Page.columns,
										{paramFunc:ListPage.paramFunc,exportable:true,buttons:Page.buttons});
										
				var crossconf = {};
				crossconf.measures = {sum:'交易金额',count:"交易数"};
				crossconf.defaultMeasure = {sum:true,count:true};
				crossconf.dimensions = {accountType:'帐户类型',tradeType:'交易类型',tradeStatus:'交易状态'
										,cardUserType:"客户类型",cardUserLevel:"客户级别",cardType:"卡类型",bank:'银行'};
				crossconf.defaultVertical = {};
				crossconf.defaultHorizon = {accountType:true,tradeType:true,tradeStatus:true};
				Page.pivot = new Pivot("pivot","counter_daily_tx",crossconf,{initPivotHead:initPivotHead,backFunc:goFirstPage});
				Page.pivot.setPivotHead('pivotTitle','发卡充值点日结报表');
				Page.pivot.setPivotHead('statOper',Common.cOperator().name);
				Page.pivot.setPivotHead("statClass",'日结报表');
				
				setPages(["listView","pivotView"]);
			}
			function initPageElements(){
				Page.sql = "daily_list_counter_SIMPLE";
				Page.DEFAULT_CUTOFF = 1;		//默认截止日期,昨天
				Page.DEFAULT_INTERNAL = 0;		//默认日期范围
				Page.selection.status={list:Common.getSubsetItems("daily_status",Clear.DailyCheck.ONLINE_STATUS)
									,nullLabel:"全  部"};//日结状态
				Page.checkable = function(r){//是否可以复核
					return false;//Clear.DailyCheck.checkOrgAuthority(r[0].status,r[0].type,r[1]);
				}
			}
			function operation(v,r){
				var s = "<a href=# onclick=\"showPivot('"+r[0]+"','"+Format.dateRender(r[2])
							+"','"+r[1]+"','"+r[5]+"');return false;\">报表<\/a>";
				return s;
			}
			function showPivot(orgID,businessDate,orgName,dailyCheckStatus){
				$('dailycheckStatus').innerHTML = '当前机构日结情况:'+dailyCheckStatus;
				var param = {};
				param.orgId = orgID;
				param.businessDate = businessDate;
				Page.pivot.param = param;
				Page.pivot.setPivotHead('statOrg',orgName);
				Page.pivot.setPivotHead("statTime",Format.today(true));
				Page.pivot.setPivotHead("businessDate",businessDate);
				Page.pivot.refresh();
				switchPage("pivotView");
			}
			function initPivotHead(div){
				var title = '<table width="100%" border="0" cellspacing="0" cellpadding="5" style="width:600">'
						  + '<tr><td align="center" class="reportTitle" height="50" colspan="2" id="#DIVID#_pivotTitle"></td></tr>'
						  + '<tr><td width="67%">统 计 人：<span id="#DIVID#_statOper"></span></td><td>统计机构：<span id="#DIVID#_statOrg"></span></td></tr>'
						  + '<tr><td>统计时间：<span id="#DIVID#_statTime"></span></td><td>报表类型：<span id="#DIVID#_statClass"></span></td></tr>'
						  + '<tr><td>业务日期：<span id="#DIVID#_businessDate"></span></td><td></td></tr></table>';
				$(div+'_pivot_head').innerHTML = title.replace(/#DIVID#/g,div);
			}
			function goFirstPage(){
				switchPage('listView');
			}
		</script>
	</head>
	<body onload="init()">
		<div class="nav"><div id="nav">&nbsp;</div></div>
	
		<div id="listView">
			<div class="searchForm">
				<form id="searchForm" name="searchForm">
					<table cellSpacing="0" cellPadding="4" width="100%" border="0">
						<tr>
							<td class="label4" id="org"></td>
							<td>
								<label>日结状态</label>
								<select name="status"><option></option></select>
							</td>
							<td></td>
						</tr>
						<tr>
							<td id="beginDateTd"></td>	
							<td id="endDateTd"></td>
							<td><button onclick="ListPage.showListTable();">查 询</button></td>
						</tr>
					</table>
				</form>
			</div>
			<div id="datalist"></div>
		</div>
		
		<div id="pivotView" style="display:none">
			<div id="dailycheckStatus" class="formTitle"></div>
			<div id="pivot"></div>
		</div>
	</body>
</html>